package com.dx.wx.service.impl;

import com.dx.wx.service.DxNewsService;
import com.dx.wx.util.DxUtil;
import com.ejlchina.data.Array;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

@Service
public class DxNewsServiceImpl implements DxNewsService {

    @Override
    public Array findAct(String appId) {
        Map map = new HashMap();
        map.put("field_name","life_status");
        map.put("field_values","normal");
        map.put("operator","EQ");
        Map map1 = new HashMap();
        map1.put("field_name","record_type"); //业务类型促销公告
        map1.put("field_values","record_LPoE8__c");
        map1.put("operator","EQ");
        Map appIdFilter = DxUtil.addAppIdFilter(appId);
        Map data = DxUtil.createSearchData(map,map1,appIdFilter);
        data.put("dataObjectApiName","banner__c");
        return DxUtil.findSimple(data);
    }

    @Override
    public Array findSale() {
        Map map = new HashMap();
        map.put("field_name","life_status");
        map.put("field_values","normal");
        map.put("operator","EQ");
        Map data = DxUtil.createSearchData(map);
        data.put("dataObjectApiName","sale_news__c");
        return DxUtil.findSimple(data);
    }

    @Override
    public Array findLottery() {
        Map map = new HashMap();
        map.put("field_name","life_status");
        map.put("field_values","normal");
        map.put("operator","EQ");
        Map data = DxUtil.createSearchData(map);
        data.put("dataObjectApiName","lottery_news__c");
        return DxUtil.findSimple(data);
    }
}
